//
//  LCHomeViewController.m
//  LendCash
//
//  Created by Mac mini on 2018/5/23.
//  Copyright © 2018年 zt. All rights reserved.
//

#import "LCHomeViewController.h"
#import "SDCycleScrollView.h"
#import "LCHomeBannerView.h"
#import "LCHomeLendView.h"
#import "LCHomeLendStrategyView.h"
#import "LCMessageCenterController.h"
#import "LCMoreStrategyController.h"
#import "LCApproveViewController.h"

@interface LCHomeViewController ()
@property (strong, nonatomic) IBOutlet LCHomeBannerView *bannerView;

@end

@implementation LCHomeViewController
-(void)itemClick:(UIBarButtonItem *)item{
    if (item.tag == rightItemClick) {
        LCMessageCenterController *message = [[LCMessageCenterController alloc]init];
        message.hidesBottomBarWhenPushed = YES;
        [self.navigationController pushViewController:message animated:YES];
    }
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self initNavLeftWithImage:@"littleLogo"];
    [self initNavRightWithImage:@"littleLogo"];
    
    _bannerView.frame = CGRectMake(0, SafeAreaTopHeight, SCREEN_W, 150);
    
    _bannerView.backgroundColor = [UIColor clearColor];
    _bannerView.localizationImageNamesGroup = @[@"logo",@"littleLogo"];
    LCHomeLendView *lendView = [[LCHomeLendView alloc]initWithFrame:CGRectMake(15, CGRectGetMaxY(_bannerView.frame) +10, SCREEN_W-30, 100)];
    lendView.lendViewCallBack = ^(lendOrWrite tag) {
        LCApproveViewController *approve = [[LCApproveViewController alloc]initWithNibName:@"LCApproveViewController" bundle:nil];
        approve.hidesBottomBarWhenPushed = YES;
        [self.navigationController pushViewController:approve animated:YES];
    };
    [self.view addSubview:lendView];

    LCHomeLendStrategyView *strategyView = [[LCHomeLendStrategyView alloc]initWithFrame:CGRectMake(15, CGRectGetMaxY(lendView.frame)+10, lendView.frame.size.width, 80)];
    strategyView.lendStrategyViewCallBack = ^(lendStrategy strategy) {
        NSLog(@"%ld",strategy);
        if(strategy == strategy_more){
            LCMoreStrategyController *more = [[LCMoreStrategyController alloc]init];
            more.hidesBottomBarWhenPushed = YES;
            [self.navigationController pushViewController:more animated:YES];
        }
    };
    [self.view addSubview:strategyView];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
